#include "oled_demo.h"

struct display_info disp;
int oled_show(void *arg) {
	unsigned char *buffer = (unsigned char *)arg;
	oled_putstrto(&disp, 0, 9+1, "This garbage is:");
	disp.font = font2;
	unsigned char showText[30] = {0};
	//	oled_putstrto(disp, 0, 18+2, "Spnd tmp    53 C");
	//	oled_putstrto(&disp, 0, 18+2, "----OrangePi----");
	switch (buffer[2])
	{
	case 0x41:
		sprintf(showText,"dry waste");
		break;
	case 0x42:
		sprintf(showText,"wet waste");
		break;
	case 0x43:
		sprintf(showText,"recyclable waste");
		break;
	case 0x44:
		sprintf(showText,"hazardous waste"); // 有害垃圾
		break;
	case 0x45:
		sprintf(showText,"recognition failed");
		break;
	default:
		break;
	}
	oled_putstrto(&disp, 0, 40, showText);
	oled_send_buffer(&disp);

	return 0;
}

int myoled_init(void)
{
	int e;

	disp.address = OLED_I2C_ADDR;
	disp.font = font2;

	e = oled_open(&disp, FILENAME);
	e = oled_init(&disp);
	return e;
}

